$(function () {
   $(window).on("resize",function () {
       let clientW = $(window).width();

       let isShowBigImage = clientW >= 800;

       let $allItems = $(".carousel-inner .item");
       //console.log($allItems);

       $allItems.each(function (index,data) {
           let src = isShowBigImage ? $(data).data("lg-img"):$(data).data("sm-img");
           //console.log(src)
           let imgUrl = "url('"+src+"')";
           console.log(imgUrl);
           $(data).css({
               backgroundImage:imgUrl
           });
           if(!isShowBigImage){
               let img = "<img src='"+src+"'>";
               $(data).empty().append(img);
           }else{
               $(data).empty();
           }
       })
   });
    $(window).trigger("resize");
    /*提示框*/
    $('[data-toggle="tooltip"]').tooltip();

    /*tab选项卡适配*/
    $(window).on("resize", function () {
       let $ul = $("#sb_product .nav");
       let $allLis = $("[role='presentation']", $ul);
       /*选择器，了解一下*/
       let totalW = 0;
       $allLis.each(function (index,item) {   /*each遍历，掌握*/
           totalW +=$(item).width();
       });
       let parentW = $ul.parent().width();
       if(totalW>parentW){
           $ul.css({
               width:totalW+"px"
           });
       }else{
           $ul.removeAttr("style");
       }
    });
    /*导航滚动*/
    let allNavLis = $("#sb_nav li");
    // console.log(allNavLis);
    $(allNavLis[2]).click(function () {
        /*alert("123");*/
       $("html,body").animate({
           scrollTop:$("#sb_hot").offset().top},1000);
    });
});